Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next

I dug out some code

Here's the declarations:



Declare Function FolderCreate Lib "nnotes.dll" Alias "FolderCreate" (Byval hDataDB As Long, Byval hFolderDB As Long, _
Byval FormatNoteID As Long, Byval hFormatDb As Long, Byval FolderName As Lmbcs String, Byval wNameLength As Integer, _
Byval FolderType As Long, Byval dwFlags As Long,pNoteID As Long) As Integer

Declare Function NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" (Byval PathName As Lmbcs String, dbHandle As Long) As Integer
Declare Function NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" (Byval dbHandle) As Integer


Here's the function:
Function createSearchResultsFolder(dbThis As Notesdatabase, strFolderProtoTypeAlias As String, strFolderName As String) As Boolean

Dim viewPrototype As NotesView
Dim docViewDesign As NotesDocument
Dim strFullPath As String
Dim strError As String

Dim dbHandle As Long
Dim lFormatNoteID As Long
Dim lFolderType As Long
Dim dwFlags As Long
Dim lNewFolderNoteID As Long

Dim nStatus As Integer

createSearchResultsFolder = False
dbHandle = 0

On Error Goto error_exit


' find the prototype

Forall view In dbThis.Views
If Not Isempty(view.Aliases) Then
Forall a In view.Aliases
If a = strFolderProtoTypeAlias Then
Set viewPrototype = view
Exit Forall
End If
End Forall
End If
If Not viewPrototype Is Nothing Then
Exit Forall
End If
End Forall

If Not viewPrototype Is Nothing Then
Set docViewDesign = dbThis.GetDocumentByUNID(viewPrototype.UniversalID)

lFormatNoteID = Clng("&H" & docViewDesign.NoteID)

' Get an API handle to this database
If Len(dbThis.Server) > 0 Then
strFullPath = dbThis.Server & "!!" & dbThis.FilePath
Else
strFullPath = dbThis.FilePath
End If

' Get a handle to the doc database
Call NSFDbOpen( strFullPath, dbHandle)
If (dbHandle <> 0) Then
' Set the Folder Type -> Private (1), flags -> 0
lFolderType = 1
dwFlags = 0

lNewFolderNoteID = 0

nStatus = FolderCreate(dbHandle, &H0, lFormatNoteID, &H0, strFolderName, &HFFFF, lFolderType, dwFlags, lNewFolderNoteID)
If nStatus = 0 Then
If lNewFolderNoteID <> 0 Then
createSearchResultsFolder = True
Else
createSearchResultsFolder = False
End If
Else
createSearchResultsFolder = False
End If

End If

End If

normal_exit:
' always do this
If (dbHandle <> 0) Then
Call NSFDbClose(dbHandle)
End If
Exit Function

error_exit:
Msgbox "Error " & Cstr(Err) & " at line " & Cstr(Erl) & " " & Error$, 0, "createSearchResultsFolder"
Resume normal_exit
End Function


Feedback response number WEBB8M5CZL created by ~Rebecca Ekjipymaretsi on 09/28/2011

Using Lotusscript to create folders... (~Zach Quetpones... 27.Sep.11)
. . Have a look at the Notes C API (~Rebecca Ekjipy... 28.Sep.11)
. . . . I dug out some code (~Rebecca Ekjipy... 28.Sep.11)
. . . . . . nnotes.dll (~Zach Quetpones... 28.Sep.11)
. . . . . . . . Never thought of that... (~Rebecca Ekjipy... 28.Sep.11)
. . . . . . THANKS Nigel! And to make shared fo... (~Wei Chuboosisk... 21.Jan.12)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS